package cn.gson.work.controller;

import cn.gson.work.model.pojos.Budcate;
import cn.gson.work.model.pojos.Budget;
import cn.gson.work.model.pojos.Project;
import cn.gson.work.model.pojos.User;
import cn.gson.work.model.service.BudgetsService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BudgetController {
    @Autowired
    BudgetsService budgetService;
    //查询所有信息
    @GetMapping("/budget")
    @ResponseBody
    public List<Budget> ys(String B_NAME){

        return budgetService.ys(B_NAME);
    }
    //查询出预算的类型
    @GetMapping("/lei")
    @ResponseBody
    public List<Budcate> lei(){
        return budgetService.lei();
    }
    //申请预算的主要负责人
    @GetMapping("/gg")
    @ResponseBody
    public List<User> gg(){
        return budgetService.gg();
    }
    //预算的对象项目
    @GetMapping("/xm")
    @ResponseBody
    public List<Project> xm(){
        return budgetService.xm();
    }
    //新增预算对象
    @PostMapping("/addBudget")
    @ResponseBody
    public void addBudget(@RequestBody Budget budget){
        budgetService.addBudget(budget);
    }

}
